package com.itheima.jdbc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 演示 Service 与 Dao 注入
 * @author weixingtk
 *
 */
public class Demo {
	public static void main(String[] args) {
	    ApplicationContext applicationContext = 
	            new ClassPathXmlApplicationContext("applicationContext.xml");
	    // 获取AccountDao实例
	    AccountDao accountDao = 
	            (AccountDao) applicationContext.getBean("accountDao");
	    //补充Service 调用
	    AccountServiceImpl accountServiceImpl = new AccountServiceImpl();
	    accountServiceImpl.setAccountDao(accountDao);
	    accountServiceImpl.pay();
	}
}
